package com.easy;

/**
 * Created by Lxk on 2019/6/1.
 */
public class Solution509 {

    public int fib(int N) {
        if(N==0){
            return 0;
        }else if(N==1){
            return 1;
        }
        int prePre = 0,pre = 1;
        for(int i = 2;i <= N; i++){
            int temp = pre;
            pre = pre + prePre;
            prePre = temp;
        }
        return pre;
    }

}
